package com.ruoyi.purchase.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.purchase.mapper.BizPurchaseOrderMapper;
import com.ruoyi.purchase.domain.BizPurchaseOrder;
import com.ruoyi.purchase.service.IBizPurchaseOrderService;
import com.ruoyi.common.core.text.Convert;

/**
 * 采购订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-16
 */
@Service
public class BizPurchaseOrderServiceImpl implements IBizPurchaseOrderService 
{
    @Autowired
    private BizPurchaseOrderMapper bizPurchaseOrderMapper;

    /**
     * 查询采购订单
     * 
     * @param orderId 采购订单主键
     * @return 采购订单
     */
    @Override
    public BizPurchaseOrder selectBizPurchaseOrderByOrderId(Long orderId)
    {
        return bizPurchaseOrderMapper.selectBizPurchaseOrderByOrderId(orderId);
    }

    /**
     * 查询采购订单列表
     * 
     * @param bizPurchaseOrder 采购订单
     * @return 采购订单
     */
    @Override
    public List<BizPurchaseOrder> selectBizPurchaseOrderList(BizPurchaseOrder bizPurchaseOrder)
    {
        return bizPurchaseOrderMapper.selectBizPurchaseOrderList(bizPurchaseOrder);
    }

    /**
     * 新增采购订单
     * 
     * @param bizPurchaseOrder 采购订单
     * @return 结果
     */
    @Override
    public int insertBizPurchaseOrder(BizPurchaseOrder bizPurchaseOrder)
    {
        bizPurchaseOrder.setCreateTime(DateUtils.getNowDate());
        return bizPurchaseOrderMapper.insertBizPurchaseOrder(bizPurchaseOrder);
    }

    /**
     * 修改采购订单
     * 
     * @param bizPurchaseOrder 采购订单
     * @return 结果
     */
    @Override
    public int updateBizPurchaseOrder(BizPurchaseOrder bizPurchaseOrder)
    {
        bizPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
        return bizPurchaseOrderMapper.updateBizPurchaseOrder(bizPurchaseOrder);
    }

    /**
     * 批量删除采购订单
     * 
     * @param orderIds 需要删除的采购订单主键
     * @return 结果
     */
    @Override
    public int deleteBizPurchaseOrderByOrderIds(String orderIds)
    {
        return bizPurchaseOrderMapper.deleteBizPurchaseOrderByOrderIds(Convert.toStrArray(orderIds));
    }

    /**
     * 删除采购订单信息
     * 
     * @param orderId 采购订单主键
     * @return 结果
     */
    @Override
    public int deleteBizPurchaseOrderByOrderId(Long orderId)
    {
        return bizPurchaseOrderMapper.deleteBizPurchaseOrderByOrderId(orderId);
    }
}
